﻿using HmExtension.Commons.Extensions;
using SCRS.Dal;
using SCRS.Model;

namespace SCRS.Bll;
/// <summary>
/// 登录业务逻辑类
/// </summary>
public class LoginBll
{   
    private AccountDal accountDal = new AccountDal();
    /// <summary>
    /// 登录
    /// </summary>
    /// <param name="userName">用户名</param>
    /// <param name="password">密码</param>
    /// <returns></returns>
    public Account? Login(string userName, string password)
    {
        var single = accountDal.Entities
            .Where(account => account.Username == userName && account.Password == password.ToMd5())
            .ToList().FirstOrDefault();
        return single;
    }
}